<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
    <title>Document</title>
    <style>
        html,
        body,
        #container {
          width: 100%;
          height: 100%;
        }
    </style>
</head>
<body>
<div id="container"></div>
</body>
</html>
<script type="text/javascript">
    window._AMapSecurityConfig = {
      securityJsCode: "b4a922fec0bec6528e909210d2242fe1",
    };
</script>
<script src="https://webapi.amap.com/loader.js"></script>
<script type="text/javascript">
    var zoom =  16
    const map = new AMap.Map("container", {
        viewMode: "2D", //默认使用 2D 模式
        zoom: 16, //地图级别
        center: [116.397428, 39.90923], //地图中心点
    });

    const marker = new AMap.Marker({
        position: [116.3914, 39.9075], //位置
        icon: 'https://tse2-mm.cn.bing.net/th/id/OIP-C.uoSusmf4EqIBTnlxa0m9mwHaHa?rs=1&pid=ImgDetMain',
        offset: new AMap.Pixel(-13, -30), //以 icon 的 [center bottom] 为原点
    });

    map.add(marker); //添加到地图

     //设置当前真实位置
    function setCurrentLocation(lon,lat){
        map.setZoomAndCenter(zoom, [lon, lat])//设置地图的缩放级别和中心点位置

        var marker = new AMap.Marker({
            position: new AMap.LngLat(lon, lat),
            icon: 'https://a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png',
            map:map
        });
        map.add(marker);
    }
</script>